package com.itheima.controller;

import com.itheima.cloud.pojo.Order;
import com.itheima.cloud.response.OrderVO;
import com.itheima.service.OrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/order")
@RefreshScope
public class OrderController {

    @Autowired
    OrderService orderService;

    @GetMapping("/findOrderByUsername")
    public List<OrderVO> findOrderByUsername(@RequestParam("username") String username){
        return orderService.findOrderByUsername(username);
    }
}
